package com.example.zhaojianxu.signin.securities.view

import android.app.DialogFragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.graphics.drawable.ColorDrawable
import android.util.DisplayMetrics
import android.graphics.Color
import android.view.Gravity
import com.example.zhaojianxu.signin.R


/**
 * create by @zhaojianxu on 2019/3/4
 */
open class NumberDialogFragment: DialogFragment(){

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {

        val view = inflater?.inflate(R.layout.fragment_dialog_number,container,false)

        return view
    }

    override fun onStart() {
        super.onStart()
        val dm = DisplayMetrics()
        activity.windowManager.defaultDisplay.getMetrics(dm)
        dialog.window!!.setLayout((dm.widthPixels * 0.8f).toInt(), (dm.heightPixels * 0.4f).toInt())
        dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        dialog.window?.setGravity(Gravity.CENTER)
    }
}